package com.handong.handserialprogram.thread;

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

/**
 * 弹出输入框。
 * Created by userKey on 2017/8/30.
 */

public class InputMethod implements Runnable {

    private View mView;

    public InputMethod(View view) {
        mView = view;
    }

    @Override
    public void run() {
        if (mView == null) {
            return;
        }
        InputMethodManager inputMethodManager =
                (InputMethodManager) mView.getContext().getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (inputMethodManager != null && inputMethodManager.isActive()) {
            inputMethodManager.showSoftInput(mView, InputMethodManager.SHOW_IMPLICIT);
        }
        mView = null;
    }
}
